﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example17.aspx.cs" Inherits="Chapter35.Example17" %>

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代码清单 35-17 使用 drawIage 方法</title>
    <meta name="author" content="Adam Freeman" />
    <meta name="description" content="A simple example" />
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
    <style>
        canvas {
            border: thin solid black;
            margin: 4px;
        }
    </style>
</head>
<body>
    <canvas id="canvas" width="500" height="140">Your browser doesn't support the <code>canvas</code> element.</canvas>
    <img src="images/bananas.jpg" alt="bananas" hidden="hidden"/>
    <script>
        var ctx = document.getElementById('canvas').getContext('2d');
        var imgElem = document.getElementById('bananas');
        ctx.drawImage(imgElem, 10, 10);
        ctx.drawImage(imgElem, 110, 10, 100, 120);
        ctx.drawImage(imgElem, 20, 20, 100, 50, 250, 10, 100, 120);
    </script>
</body>
</html>
